//
//  BanJiKaoQingTopView.m
//  SanYiTeaching
//
//  Created by 李文强 on 2019/4/15.
//  Copyright © 2019 SanYi. All rights reserved.
//

#import "BanJiKaoQingTopView.h"

@implementation BanJiKaoQingTopView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/
- (instancetype)initWithFrame:(CGRect)frame{
    if ([super initWithFrame:frame]) {
        [self initSubView];
    }
    return self;
}
- (MinButtonViewBtn *)leftButton{
    if (!_leftButton) {
        MinButtonViewBtn *btn = [[MinButtonViewBtn alloc]initWithFrame:CGRectMake(550*fw, 15, 100, 20) andType:ButtonImageInRight];
        btn.bottomLabel.text = @"开始日期";
        btn.bottomLabel.font = [UIFont systemFontOfSize:12];
        btn.bottomLabel.textColor = TITLECOLOR;
        btn.topImage.image = [UIImage imageNamed:@"arrow_down"];
        [btn addTarget:self action:@selector(leftButtonClick:) forControlEvents:UIControlEventTouchUpInside];
        [btn.bottomLabel mas_updateConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(@0);
            make.right.equalTo(@0).offset(-15);
        }];
        _leftButton = btn;
    }
    return _leftButton;
}
- (void)leftButtonClick:(MinButtonViewBtn *)sender{
    [self.mainDelegate kaiShiRiQiSelected];
}
- (MinButtonViewBtn *)rightButton{
    if (!_rightButton) {
        MinButtonViewBtn *btn = [[MinButtonViewBtn alloc]initWithFrame:CGRectMake(550*fw, 15, 100, 20) andType:ButtonImageInRight];
        btn.bottomLabel.text = @"结束日期";
        btn.bottomLabel.font = [UIFont systemFontOfSize:12];
        btn.bottomLabel.textColor = TITLECOLOR;
        btn.topImage.image = [UIImage imageNamed:@"arrow_down"];
        [btn addTarget:self action:@selector(rightButtonClick:) forControlEvents:UIControlEventTouchUpInside];
        [btn.bottomLabel mas_updateConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(@0);
            make.right.equalTo(@0).offset(-15);
        }];
        _rightButton = btn;
    }
    return _rightButton;
}
- (void)rightButtonClick:(MinButtonViewBtn *)sender{
    [self.mainDelegate jieShuRiQiSelected];
}
- (UIView *)backView{
    if (!_backView) {
        UIView *view = [[UIView alloc]init];
        view.backgroundColor = CONTENTBACKCOLOR;
        _backView = view;
    }
    return _backView;
}
- (void)initSubView{
    self.backgroundColor = [UIColor whiteColor];
    [self addSubview:self.titleLabel];
    [self addSubview:self.dangQianJinDuLabel];
    [self addSubview:self.keChengLabel];
    [self addSubview:self.renKeLaoShiLabel];
    [self addSubview:self.nianJiLabel];
    [self addSubview:self.shangKeShiJianLabel];
    [self addSubview:self.keMuLabel];
    [self addSubview:self.zhaoShengRenShuLabel];
    [self addSubview:self.jiaoShiLabel];
    [self addSubview:self.jieYeShiJianLabel];
    [self addSubview:self.backView];
    [self addSubview:self.studentLab];//学生信息  lab
//    [_backView addSubview:self.leftButton];
//    [_backView addSubview:self.rightButton];
    [self addSubview:self.lineView];
    [_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@10);
        make.top.equalTo(@10);
        make.right.equalTo(self.mas_centerX);
        make.height.equalTo(@13);
    }];
    [_dangQianJinDuLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_centerX).offset(10);
        make.top.equalTo(self.titleLabel.mas_top);
        make.right.equalTo(@0).offset(-10);
        make.height.equalTo(@13);
    }];
    [_keChengLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@10);
        make.top.equalTo(self.titleLabel.mas_bottom).offset(11);
        make.right.equalTo(self.mas_centerX);
        make.height.equalTo(@12);
    }];
    [_renKeLaoShiLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_centerX).offset(10);
        make.top.equalTo(self.titleLabel.mas_bottom).offset(11);
        make.right.equalTo(@0).offset(-10);
        make.height.equalTo(@13);
    }];
    [_nianJiLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@10);
        make.top.equalTo(self.keChengLabel.mas_bottom).offset(11);
        make.right.equalTo(self.mas_centerX);
        make.height.equalTo(@13);
    }];
    [_shangKeShiJianLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_centerX).offset(10);
        make.top.equalTo(self.keChengLabel.mas_bottom).offset(11);
        make.right.equalTo(@0).offset(10);
        make.height.equalTo(@13);
    }];
    [_keMuLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@10);
        make.top.equalTo(self.nianJiLabel.mas_bottom).offset(11);
        make.right.equalTo(self.mas_centerX);
        make.height.equalTo(@13);
    }];
    [_zhaoShengRenShuLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_centerX).offset(10);
        make.top.equalTo(self.nianJiLabel.mas_bottom).offset(11);
        make.right.equalTo(@0).offset(-10);
        make.height.equalTo(@13);
    }];
    [_jiaoShiLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@10);
        make.top.equalTo(self.keMuLabel.mas_bottom).offset(11);
        make.right.equalTo(self.mas_centerX);
        make.height.equalTo(@13);
    }];
    [_jieYeShiJianLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_centerX).offset(10);
        make.top.equalTo(self.keMuLabel.mas_bottom).offset(11);
        make.right.equalTo(@0).offset(-10);
        make.height.equalTo(@13);
    }];
    [_backView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@0);
        make.bottom.equalTo(self.mas_bottom).offset(-1);
        make.right.equalTo(@0);
        make.height.equalTo(@30);
    }];
    [self.studentLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.mas_centerX);
        make.bottom.equalTo(@-3);
    }];
   
//    [_leftButton mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.right.equalTo(self.mas_centerX).offset(-10);
//        make.top.equalTo(@0);
//        make.width.equalTo(@100);
//        make.height.equalTo(@30);
//    }];
//    [_rightButton mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.left.equalTo(self.mas_centerX).offset(10);
//        make.top.equalTo(@0);
//        make.width.equalTo(@100);
//        make.height.equalTo(@30);
//    }];
    [_lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@0);
        make.bottom.equalTo(@0);
        make.right.equalTo(@0);
        make.height.equalTo(@1);
    }];
}
- (UIView *)lineView{
    if (!_lineView) {
        UIView *view = [[UIView alloc]init];
        view.backgroundColor = LINCOLOR;
        _lineView = view;
    }
    return _lineView;
}
- (UILabel *)titleLabel{
    if (!_titleLabel) {
        UILabel *label = [[UILabel alloc] init];
        label.frame = CGRectMake(330.5,79.5,140.5,13);
        label.numberOfLines = 0;
        label.text = @"单茹 18 新一 1-D 六A";
        label.font = [UIFont systemFontOfSize:14];
        label.textColor = SELECTEDCOLOR;
        _titleLabel = label;
    }
    return _titleLabel;
}
- (UILabel *)dangQianJinDuLabel{
    if (!_dangQianJinDuLabel) {
        UILabel *label = [[UILabel alloc] init];
        label.frame = CGRectMake(330.5,79.5,140.5,13);
        label.numberOfLines = 0;
        label.text = @"当前进度：L25-26 ";
        label.font = [UIFont systemFontOfSize:12];
        label.textColor = TITLECOLOR;
        label.attributedText = [PublickFunctionObject getPriceAttribute:label.text and:SELECTEDCOLOR andChangeBenginString:@"：" andEndString:@" " andSize:12];
        _dangQianJinDuLabel = label;
    }
    return _dangQianJinDuLabel;
}
- (UILabel *)keChengLabel{
    if (!_keChengLabel) {
        UILabel *label = [[UILabel alloc] init];
        label.frame = CGRectMake(330,103,178.5,11.5);
        label.numberOfLines = 0;
        label.textColor = TITLECOLOR;
        label.font = [UIFont systemFontOfSize:12];
        label.attributedText = [PublickFunctionObject getPriceAttribute:@"课程名称：音标+新一1期1-34次 " and:SELECTEDCOLOR andChangeBenginString:@"：" andEndString:@" " andSize:12];
        _keChengLabel = label;
    }
    return _keChengLabel;
}
- (UILabel *)renKeLaoShiLabel{
    if (!_renKeLaoShiLabel) {
        UILabel *label = [[UILabel alloc] init];
        label.frame = CGRectMake(330,103,178.5,11.5);
        label.numberOfLines = 0;
        label.textColor = TITLECOLOR;
        label.font = [UIFont systemFontOfSize:12];
        label.text = @"任课老师：候园/单茹,李梦迪";
        _renKeLaoShiLabel = label;
    }
    return _renKeLaoShiLabel;
}
- (UILabel *)nianJiLabel{
    if (!_nianJiLabel) {
        UILabel *label = [[UILabel alloc] init];
        label.frame = CGRectMake(330,103,178.5,11.5);
        label.numberOfLines = 0;
        label.textColor = TITLECOLOR;
        label.font = [UIFont systemFontOfSize:12];
        label.attributedText = [PublickFunctionObject getPriceAttribute:@"年级：3-6年级 " and:SELECTEDCOLOR andChangeBenginString:@"：" andEndString:@" " andSize:12];
        _nianJiLabel = label;
    }
    return _nianJiLabel;
}
- (UILabel *)shangKeShiJianLabel{
    if (!_shangKeShiJianLabel) {
        UILabel *label = [[UILabel alloc] init];
        label.frame = CGRectMake(330,103,178.5,11.5);
        label.numberOfLines = 0;
        label.textColor = TITLECOLOR;
        label.font = [UIFont systemFontOfSize:12];
        label.attributedText = [PublickFunctionObject getPriceAttribute:@"上课时间：周六07:50~09:50 " and:SELECTEDCOLOR andChangeBenginString:@"：" andEndString:@" " andSize:12];
        _shangKeShiJianLabel = label;
    }
    return _shangKeShiJianLabel;
}
- (UILabel *)keMuLabel{
    if (!_keMuLabel) {
        UILabel *label = [[UILabel alloc] init];
        label.frame = CGRectMake(330,103,178.5,11.5);
        label.numberOfLines = 0;
        label.textColor = TITLECOLOR;
        label.font = [UIFont systemFontOfSize:12];
        label.attributedText = [PublickFunctionObject getPriceAttribute:@"科目：新概念一/每周一次课 " and:SELECTEDCOLOR andChangeBenginString:@"：" andEndString:@" " andSize:12];
        _keMuLabel = label;
    }
    return _keMuLabel;
}
- (UILabel *)zhaoShengRenShuLabel{
    if (!_zhaoShengRenShuLabel) {
        UILabel *label = [[UILabel alloc] init];
        label.frame = CGRectMake(330,103,178.5,11.5);
        label.numberOfLines = 0;
        label.textColor = TITLECOLOR;
        label.font = [UIFont systemFontOfSize:12];
        label.attributedText = [PublickFunctionObject getPriceAttribute:@"招生人数：34/34 " and:SELECTEDCOLOR andChangeBenginString:@"：" andEndString:@" " andSize:12];
        _zhaoShengRenShuLabel = label;
    }
    return _zhaoShengRenShuLabel;
}
- (UILabel *)jiaoShiLabel{
    if (!_jiaoShiLabel) {
        UILabel *label = [[UILabel alloc] init];
        label.frame = CGRectMake(330,103,178.5,11.5);
        label.numberOfLines = 0;
        label.textColor = TITLECOLOR;
        label.font = [UIFont systemFontOfSize:12];
        label.attributedText = [PublickFunctionObject getPriceAttribute:@"教室：郑东商业中心校区-3教室 " and:SELECTEDCOLOR andChangeBenginString:@"：" andEndString:@" " andSize:12];
        _jiaoShiLabel = label;
    }
    return _jiaoShiLabel;
}
- (UILabel *)jieYeShiJianLabel{
    if (!_jieYeShiJianLabel) {
        UILabel *label = [[UILabel alloc] init];
        label.frame = CGRectMake(330,103,178.5,11.5);
        label.numberOfLines = 0;
        label.textColor = TITLECOLOR;
        label.font = [UIFont systemFontOfSize:12];
        label.attributedText = [PublickFunctionObject getPriceAttribute:@"结业日期：2019-3-30 " and:[UIColor redColor] andChangeBenginString:@"：" andEndString:@" " andSize:12];
        _jieYeShiJianLabel = label;
    }
    return _jieYeShiJianLabel;
}

- (UILabel *)studentLab {
    if (!_studentLab) {
        _studentLab = [UILabel titleColour:[UIColor colorWithHexString:@"#333333"]
                                titleFount:13
                                  pingfang:@"PingFang-SC-Regular"
                                 alignment:NSTextAlignmentCenter
                                 titleLine:1];
        _studentLab.text = @"学生信息";
    }
    return _studentLab;
}

- (void)setTtitleLabelText:(NSString *)string{
    _titleLabel.text = string;
}
- (void)setDangQianJinDuLabelText:(NSString *)string{
    _dangQianJinDuLabel.attributedText = [PublickFunctionObject getPriceAttribute:[NSString stringWithFormat:@"当前进度：%@",string] and:SELECTEDCOLOR andChangeBenginString:@"：" andEndString:@"" andSize:12];
}
- (void)setKeChengLabelText:(NSString *)string{
    
    _keChengLabel.attributedText = [PublickFunctionObject getPriceAttribute:[NSString stringWithFormat:@"课程名称：%@",string] and:SELECTEDCOLOR andChangeBenginString:@"：" andEndString:@"" andSize:12];
}
- (void)setRenKeLaoShiLabelText:(NSString *)string{
    _renKeLaoShiLabel.text = [NSString stringWithFormat:@"任课老师：%@",string];
}
- (void)setNianJiLabelText:(NSString *)string{
    _nianJiLabel.attributedText = [PublickFunctionObject getPriceAttribute:[NSString stringWithFormat:@"班级类型：%@",string] and:SELECTEDCOLOR andChangeBenginString:@"：" andEndString:@"" andSize:12];
}
- (void)setShangKeShiJianLabelText:(NSString *)string{
    _shangKeShiJianLabel.attributedText = [PublickFunctionObject getPriceAttribute:[NSString stringWithFormat:@"上课时间：%@",string] and:SELECTEDCOLOR andChangeBenginString:@"：" andEndString:@"" andSize:12];
}
- (void)setKeMuLabelText:(NSString *)string{
    
    _keMuLabel.attributedText = [PublickFunctionObject getPriceAttribute:[NSString stringWithFormat:@"状态：%@",string] and:SELECTEDCOLOR andChangeBenginString:@"：" andEndString:@"" andSize:12];
}
- (void)setZhaoShengRenShuLabelext:(NSString *)string{
    _zhaoShengRenShuLabel.attributedText = [PublickFunctionObject getPriceAttribute:[NSString stringWithFormat:@"招生人数：%@",string] and:SELECTEDCOLOR andChangeBenginString:@"：" andEndString:@"" andSize:12];
}
- (void)setJiaoShiLabelText:(NSString *)string{
    _jiaoShiLabel.attributedText = [PublickFunctionObject getPriceAttribute:[NSString stringWithFormat:@"教室：%@",string] and:SELECTEDCOLOR andChangeBenginString:@"：" andEndString:@"" andSize:12];
}
- (void)setJieYeShiJianLabelText:(NSString *)string{
    _jieYeShiJianLabel.attributedText = [PublickFunctionObject getPriceAttribute:[NSString stringWithFormat:@"结业日期：%@",string] and:[UIColor redColor] andChangeBenginString:@"：" andEndString:@"" andSize:12];
}

@end
